package com.tfswue.cxy.service;

import com.tfswue.cxy.event.UserRegisteredEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.stereotype.Service;

@Service
public class EnventPublisherService implements ApplicationEventPublisherAware {

    private ApplicationEventPublisher publisher;

    @Override
    public void setApplicationEventPublisher(
            ApplicationEventPublisher applicationEventPublisher) {
        this.publisher = applicationEventPublisher;

    }
    public void pubilshUserRegistered(String username, String email){
        publisher.publishEvent(new UserRegisteredEvent(this,username,email));
    }
}
